package model.rsquare;

import lombok.Data;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author 刀氏春秋
 * @date 2023/6/16
 */
@Data
public class CombineRSquare {
    private Map<String, Double> rSquares;

    public CombineRSquare(Map<String, Double> rSquares) {
        this.rSquares = rSquares;
    }

    public void addResult(String assetNo, Double rSquare) {
        this.rSquares.put(assetNo, rSquare);
    }

    public List<Double> getRSquareResult() {
        // 将数据转化为列表
        Set<String> assetNos = this.rSquares.keySet();
        List<Double> rSquare = new LinkedList<>();

        for (String assetNo : assetNos) {
            rSquare.add(this.rSquares.get(assetNo));
        }

        return rSquare;
    }
}
